<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template name="noLongWords">
 <xsl:param name="text"/>
 <xsl:param name="limit"/>
 <xsl:param name="cc"/>
 <xsl:choose>
   <xsl:when test="$cc &lt; 0">
   	...
	</xsl:when>
   <xsl:when test="string-length(substring-before($text,' ')) &gt; 0 and string-length(substring-before($text,' ')) &lt; $limit">
<xsl:value-of select="substring-before($text,' ')"/>&#32;<xsl:if test="string-length(substring-after($text,' ')) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring-after($text,' ')"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring-before($text,' '))"/></xsl:call-template></xsl:if>
	</xsl:when>
   <xsl:when test="(string-length(substring-before($text,' ')) = 0)">
<xsl:value-of select="substring($text,1,$limit)"/>&#32;<xsl:if test="string-length(substring($text,$limit)) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring($text,$limit)"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring($text,1,$limit))"/></xsl:call-template></xsl:if>
	</xsl:when>
   <xsl:when test="(string-length($text) &gt; $limit ) or string-length(substring-before($text,' ')) &gt; $limit">
<xsl:value-of select="substring($text,1,$limit)"/>&#32;<xsl:if test="string-length(substring($text,$limit )) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring($text,$limit )"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring($text,1,$limit))"/></xsl:call-template></xsl:if>
	</xsl:when>
 </xsl:choose>
</xsl:template>
<xsl:include href='../xsl.include.main.xsl'/>

<xsl:template name="sp2br">
 <xsl:param name="text"/>
 <xsl:choose>
   <xsl:when test="contains($text,'&#32;')">
     <xsl:value-of select="substring-before($text,'&#32;')"/>
     <br/>
     <xsl:call-template name="sp2br">
       <xsl:with-param name="text">
         <xsl:value-of select="substring-after($text,'&#32;')"/>
       </xsl:with-param>
     </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="$text"/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>


<xsl:template match="forum">

<TABLE class="body" cellSpacing="0" cellPadding="0"  border="0">
	<TBODY>
		<TR>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-tl.gif" width="8" border="0"/></TD>
			<TD width="100%" background="/imgs/pvts/box-t-back.gif"><IMG height="8" src="/imgs/pvts/box-t.gif" width="10" border="0"/></TD>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-tr.gif" width="8" border="0"/></TD>
		</TR>
<!--		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif"><IMG height="10" src="/imgs/pvts/box-l.gif" width="8" border="0"/></TD>

		<TD width="100%" align="center" style="padding:5px;border-bottom:1px dotted #000000;">Messaggi dell'evento : <b><xsl:value-of select="@title"/></b>
			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>  -->
		<TR vAlign="top">
			<TD width="8" background="/imgs/pvts/box-l-back.gif"><IMG height="10" src="/imgs/pvts/box-l.gif" width="8" border="0"/></TD>
			<TD width="100%" align="left" style="padding:5px;" class="body9">

<table border="0" cellspacing="0" cellpadding="5" width="100%" class="body">
<xsl:for-each select="row[@public!=3]">
	<tr>
			<td class="body9" style="border-bottom:1px dotted;">

			<nobr>
			<xsl:call-template name="user">
				<xsl:with-param name="status" select="@uStatus"/>
				<xsl:with-param name="sexid" select="@sexid"/>
				<xsl:with-param name="certified" select="@certified"/>
				<xsl:with-param name="userid" select="@userid"/>
				<xsl:with-param name="nick" select="@nick"/>
			</xsl:call-template>
			</nobr>
			<br/>
			<xsl:variable name="userid" select="@userid"/>
			<xsl:choose>
				<xsl:when test='count(/forum/onlineusers/freak/user[@userid = $userid])'><img style="float:left;margin-left:10px;margin-top:2px;" src="/imgs/online.gif"/><div class="segue" style="position:absolute;margin-top:2px;margin-left:9px;">Online</div></xsl:when>
				<xsl:otherwise><img style="float:left;margin-left:10px;margin-top:2px;" src="/imgs/offline.gif"/><div class="segue" style="position:absolute;margin-top:2px;margin-left:9px;">Offline</div></xsl:otherwise>
			</xsl:choose>

			</td>

	<td style="border-bottom:1px dotted;">
	<xsl:choose>
		<xsl:when test="@public=2">
			<b>Messaggio cancellato!</b>
		</xsl:when>

		<xsl:when test='@ngId'>
			<a href="/forumReadMessage.aspx?forumid={/forum/@ID}&amp;msgid={@ID}&amp;forumStep={/forum/@forumStep}&amp;forumPage={/forum/@page}">
			<xsl:call-template name="blf">
			<xsl:with-param name="text" select="@text"/>
			</xsl:call-template>
			</a>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="@text" disable-output-escaping="yes"/>
			
			<div class="b10b" style="padding-top:4px; color:#666666;">(
			<xsl:call-template name="ggmmaahhmm">
				<xsl:with-param name="time" select="@time"/>
				<xsl:with-param name="cr" select="0"/>
			</xsl:call-template>
			<a style="color:#666666;" href="/forumReadMessage.aspx?forumid={/forum/@ID}&amp;msgid={@ID}&amp;forumStep={/forum/@forumStep}">
			)
			</a>
			</div>
		</xsl:otherwise>
	</xsl:choose>
	</td>
	<td style="border-bottom:1px dotted;" class="body9">
		<xsl:value-of select="substring(@time,9,2)"/>-<xsl:value-of select="substring(@time,6,2)"/>-<xsl:value-of select="substring(@time,3,2)"/><br/>
		<xsl:value-of select="substring(@time,12,8)"/>
	</td>
	</tr>
</xsl:for-each>
<tr><td align="center" colspan="3">
	<table border="0" width="100%" cellpadding="0">
	<tr>
<xsl:choose>
	<xsl:when test='/forum/@isInvitedEnabled = 1 and /forum/@isInvited != 1'>
		<td align="left"><a class="body_10px_red" href="/help/showError.aspx?error=940">Scrivi ai partecipanti</a></td>
	</xsl:when>
	<xsl:when test='/forum/@logged'>

<xsl:choose>
	<xsl:when test='/forum/@activityId'>
		<td align="left"><a class="body_10px_red" href="/post2activity.aspx?activityId={/forum/@activityId}&amp;forumId={@ID}&amp;forumStep={/forum/@forumStep}&amp;forumPage={@page}">Scrivi ai partecipanti</a></td>
	</xsl:when>
	<xsl:when test='/forum/@holidayId'>
		<td align="left"><a class="body_10px_red" href="/post2activity.aspx?holidayId={/forum/@holidayId}&amp;forumId={@ID}&amp;forumStep={/forum/@forumStep}&amp;forumPage={/forum/@page}">Scrivi ai partecipanti</a></td>
	</xsl:when>
	<xsl:otherwise>
		<td align="left"><a class="body_10px_red" href="/post2activity.aspx?forumId={@ID}&amp;forumStep={/forum/@forumStep}&amp;forumPage={/forum/@page}">Scrivi ai partecipanti</a></td>
	</xsl:otherwise>
</xsl:choose>

	</xsl:when>
	<xsl:otherwise>
		<td align="left"><font class="body_10px_red" style="cursor:pointer; text-decoration: underline;" onmouseover="ShowTooltipRight('1scrivi');" onmouseout="HideTooltip('1scrivi');">Scrivi ai partecipanti</font></td>
	</xsl:otherwise>
</xsl:choose>

	<td align="right">

			<xsl:variable name="addUrl">
				<xsl:choose>
					<xsl:when test='/forum/@activityId'>
						<xsl:value-of select="'&amp;activityId='"/>
						<xsl:value-of select="/forum/@activityId"/>
					</xsl:when>
					<xsl:when test='/forum/@holidayId'>
						<xsl:value-of select="'&amp;holidayId='"/>
						<xsl:value-of select="/forum/@holidayId"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="'&amp;forumId='"/>
						<xsl:value-of select="/forum/@ID"/>
					</xsl:otherwise>
				</xsl:choose>

			  <xsl:value-of select="'&amp;forumStep='"/>
			  <xsl:value-of select="/forum/@forumStep"/>
			</xsl:variable>

				<xsl:call-template name="browse-bar">
					<xsl:with-param name="page" 		select="@page"/>
					<xsl:with-param name="nrpages" 	select="@nrsteps"/>
					<xsl:with-param name="MyUrl" 		select="@MyUrl"/>
					<xsl:with-param name="varPage" 	select="'?forumPage='"/>
					<xsl:with-param name="addUrl" 	select="$addUrl"/>
		</xsl:call-template>


	</td>
	</tr>
	</table>
</td></tr>
	</table>

			</TD>
			<TD width="8" background="/imgs/pvts/box-r.gif"><IMG height="10" src="/imgs/pvts/box-r.gif" width="8" border="0"/></TD>
		</TR>
		<TR>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-bl.gif" width="8" border="0"/></TD>
			<TD width="100%" background="/imgs/pvts/box-b.gif"><IMG height="8" src="/imgs/pvts/box-b.gif" width="10" border="0"/></TD>
			<TD width="8"><IMG height="8" src="/imgs/pvts/box-br.gif" width="8" border="0"/></TD>
		</TR>
	</TBODY>
</TABLE>

</xsl:template>

</xsl:stylesheet>